<?php

/**
 * Класс описания микроданных для поисковиков
 * Тип LodgingBusiness
 *
 * @author xStream
 * @version 1.0.0
 */

class Microdata_Hotel extends Microdata_Base {
	const google_type = 'LodgingBusiness';
	
	public function __construct(BaseHotel $objHotel = null) {
		if(!$objHotel) return;
		
		$this->geo = new Microdata_Geo($objHotel);
		$this->address = new Microdata_Address($objHotel);
		$this->photo = new Microdata_Image($objHotel);
		
		$this->aggregateRating = new Microdata_Rating($objHotel);
		
		$this->telephone = '';

		$arrHotel = & $objHotel->tableFields;
		$this->name = View_Hotel::getName($arrHotel);
		$this->description = htmlspecialchars(strip_tags(nl2br(View_Hotel::getDescription($arrHotel))));
		
		@$this->image = $this->photo->contentUrl;
		$this->map = 'http://maps.google.com/maps?q=' . urlencode($this->address->streetAddress) . ' (' . $this->name . ')' . '&z=15&sll=' . $this->geo->latitude . ',' . $this->geo->longitude;
		
		$this->valid = true;
	}
	
	public function __get($name) {
		return new Microdata_Base();
	}
}
